package cn.kimming.rpc.demo.ui.vo;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class ServiceVO implements Serializable {
    private String serviceName;
    private List<ServiceInstance> instances = new ArrayList<>();

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public List<ServiceInstance> getInstances() {
        return instances;
    }

    public void setInstances(List<ServiceInstance> instances) {
        this.instances = instances;
    }

    public void addInstance(ServiceInstance instance) {
        instances.add(instance);
    }

    public static class ServiceInstance {
        private String id;
        private String description;
        private String version;
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date registrationTime;
        private String address;
        private Integer port;
        private Integer callCount;
        private Boolean enabled;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public String getVersion() {
            return version;
        }

        public void setVersion(String version) {
            this.version = version;
        }

        public Date getRegistrationTime() {
            return registrationTime;
        }

        public void setRegistrationTime(Date registrationTime) {
            this.registrationTime = registrationTime;
        }

        public String getAddress() {
            return address;
        }

        public void setAddress(String address) {
            this.address = address;
        }

        public Integer getPort() {
            return port;
        }

        public void setPort(Integer port) {
            this.port = port;
        }

        public Integer getCallCount() {
            return callCount;
        }

        public void setCallCount(Integer callCount) {
            this.callCount = callCount;
        }

        public Boolean getEnabled() {
            return enabled;
        }

        public void setEnabled(Boolean enabled) {
            this.enabled = enabled;
        }


        public ServiceInstance() {
        }
    }
}
